home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / bytesc88.arc / FWRITE.C < prev    next >
Text File  |  1987-10-04  |  1KB  |  31 lines

  1. #define NOCCARGC  /* no argument count passing */
  2. #include clib.def
  3. extern int Ustatus[];
  4. /*
  5. ** Item-stream write to fd.
  6. ** Entry: buf = address of source buffer
  7. **         sz = size of items in bytes
  8. **          n = number of items to write
  9. **         fd = file descriptor
  10. ** Returns a count of the items actually written or
  11. ** zero if an error occurred.
  12. ** May use ferror(), as always, to detect errors.
  13. */
  14. fwrite(buf, sz, n, fd) char *buf; int sz, n, fd; {
  15.   if(write(fd, buf, n*sz) == -1) return (0);
  16.   return (n);
  17.   }
  18.  
  19. /*
  20. ** Binary-stream write to fd.
  21. ** Entry:  fd = file descriptor
  22. **        buf = address of source buffer
  23. **          n = number of bytes to write
  24. ** Returns a count of the bytes actually written or
  25. ** -1 if an error occurred.
  26. ** May use ferror(), as always, to detect errors.
  27. */
  28. write(fd, buf, n) int fd, n; char *buf; {
  29.   return(Uwrite(buf,fd,n));
  30.   }
  31.